// src\stores\role.ts
import { defineStore } from 'pinia';

// 角色代码到中文的映射

export const useRoleStore = defineStore('role', {
  state: () => ({

    roleNames: {

      FARMER: '农民',
      MANAGER: '管理员',

    } as Record<string, string>,
  }),
  getters: {
    getRoleName: (state) => (role: string) => {
      return state.roleNames[role] || role; // 如果角色不存在，返回原始值
    },
  },
});